package com.intct.hbase.dml;

import org.apache.hadoop.hbase.client.Delete;
import org.apache.hadoop.hbase.client.Table;
import org.apache.hadoop.hbase.util.Bytes;

import java.io.IOException;

/**
 * @author gufg
 * @since 2025-07-11 10:55
 */
public class DeleteDataImpl extends AbsDMLBase {
    @Override
    public void execCommand(Table table) throws IOException {
        // 删除数据
        Delete delete = new Delete(Bytes.toBytes("1001"));

        // 删除之后，再查询会显示上一版本数据
        // delete.addColumn(Bytes.toBytes("f1"), Bytes.toBytes("name"));

        // 删除之后，把所有版本数据删除
        delete.addColumns(Bytes.toBytes("f1"), Bytes.toBytes("age"));

        table.delete(delete);
    }

    public static void main(String[] args) throws IOException {
        new DeleteDataImpl().start("intct82", "t001");
    }
}
